#ifndef __BLOCK_FACTORY_H__
#define __BLOCK_FACTORY_H__

#include "./includes/register_pack.h"
#include "block.h"
#include "chain_register_factory.h"

class BlockFactory{
	private:
		unsigned int blockSize;
		ChainRegisterFactory chainFactory;
		
	public:
		BlockFactory(unsigned int blockSize);
		~BlockFactory();

		unsigned int getBlockSize(){ return blockSize; }

		const ChainRegisterFactory& getChainFactory(){ return chainFactory; }

		/* Dado un array de bytes devuelve un bloque */
		Block* operator ()(char* data,const RegisterFactory& factory);
		
		/* Dado un bloque y un array de bytes serializa la clase Bloque en el array de bytes */
		char* operator ()(Block &block, char* data)const;
				
};

#endif /* __BLOCK_FACTORY_H__ */
